<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>发表帖子 - 学习资源平台</title>
    <link rel="stylesheet" th:href="@{/css/common.css}">
    <link rel="stylesheet" th:href="@{/css/navbar.css}">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link rel="stylesheet" th:href="@{/css/forumpublish.css}">
</head>
<body>
<div class="container">
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg">
        <div class="container">
            <a class="navbar-brand" href="#">云学堂</a>
            <div class="collapse navbar-collapse">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/resource/list}">学习资源</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/assignment/list}">作业与考试</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" th:href="@{/forum/list}">交流互动</a>
                    </li>
                    <li class="nav-item" th:if="${session.identity=='superAdmin' || session.identity=='ordinaryAdmin'}">
                        <a class="nav-link" th:href="@{/admin/index}">管理中心</a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/user/digital}">个人中心</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/user/logout}">退出</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    <!-- 主内容 -->
    <div class="row mt-4">
        <div class="col-12">
            <h2>发表新帖</h2>
            <form th:action="@{/forum/publish}" method="post">
                <div class="form-group">
                    <label for="categoryId" class="form-label">版块</label>
                    <select class="form-control" id="categoryId" name="categoryId" required>
                        <option value="">请选择版块</option>
                        <option th:each="category : ${categoryList}" th:value="${category.id}" th:text="${category.name}"></option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="title" class="form-label">帖子标题</label>
                    <input type="text" class="form-control" id="title" name="title" required placeholder="请输入帖子标题">
                </div>
                
                <div class="form-group">
                    <label for="content" class="form-label">帖子内容</label>
                    <textarea class="form-control" id="content" name="content" rows="10" required placeholder="请输入帖子内容"></textarea>
                </div>
                
                <button type="submit" class="btn btn-primary">
                    <i class="fas fa-paper-plane me-2"></i>发表
                </button>
                <a th:href="@{/forum/list}" class="btn btn-secondary">
                    <i class="fas fa-times me-2"></i>取消
                </a>
            </form>
        </div>
    </div>
</div>

</body>
</html>